package enums;

public enum UserResCodeEnum {
    CODE_SUCCESS(0,"验证码发送成功"),
    CODE_FAIL(-1, "验证码发送失败"),
    LOGIN_SUCCESS(0,"登录成功"),
    LOGIN_FAIL(-1, "登录失败"),
    GET_SUCCESS(0,"获取用户成功"),
    GET_FAIL(-1, "获取用户失败"),
    TOKEN_OK(0,"获取token成功"),
    TOKEN_FAIL(-1, "获取token失败"),
    REG_OK(0,"注册成功"),
    REG_FAIL(-1,"注册失败"),
    CENT_OK(0,"获取有效积分成功"),
    CENT_FAIL(-1,"获取积分失败"),
    CENT_RECORD_OK(0,"获取记录成功"),
    CENT_RECORD_FAIL(-1,"获取记录失败"),
    ALL_RIGHTS_OK(0,"获取所有权限记录成功"),
    ALL_RIGHTS_FAIL(-1,"获取所有权限记录失败"),
    AUTH_TIME_OUT(-1, "获取失败，授权超时，请重新获取"),
    NO_ACCESS_TOKEN(10000, "缺少accessToken参数"),
    UG_ACCESS_TOKEN(10001, "accessToken无效"),
    OVER_ACCESS_TOKEN(10002, "accessToken已过期，请重新获取"),
    UG_PAEAMES(10003,"缺少必要参数"),
    UG_APPID(10004,"不合法的appid"),
    UG_SECRET(10005,"不合法的secret"),
    UG_MEMBER(10006,"不合法的用户"),
    UG_OPENID(10007,"不合法的openid"),
    INSUFFICIENT(10008,"条件不足"),
    US_NULL(10009,"该用户不存在"),
    US_EXPR(10010,"该系统用户过期"),
    US_LOCK(10011,"该系统用户已锁定"),
    NULL_REPONSE(10012,"返回值为空"),
    NO_DATA(10013,"没数据"),
    USE_COUPON_FAIL(10014,"优惠券核销失败"),
    US_FALSE_PWD(10015,"用户密码输入错误"),
    CODE_REPEAT(10016,"单号重复"),
    CUSTOM(10017,"自定义"),
    USER_EXISTS(10018,"用户已注册"),
    INCORRECT_PHONE(10019,"请输入正确的电话号码"),
    EMPTY_NUM(10020,"请输入电话号码"),
    EMPTY_CODE(10021,"验证码不能为空"),
    WRONG_CODE(10022,"验证码错误"),
    SIGN_IN_FAIL(10023,"签到失败"),
    FROZEN_ACCOUNT(10025,"账户已冻结"),
    SIGN_IN_SUCCESS(10024,"签到成功"),
    LOGIN_FAIL_PHONE(10026,"缺少手机号")
    ;
    private Integer code;
    private String msg;

    private UserResCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static String getMsgByCode(Integer code) {
        String msg = "";
        UserResCodeEnum[] array = UserResCodeEnum.values();
        for (UserResCodeEnum obj : array) {
            if (code.equals(obj.code)) {
                msg = obj.msg;
                break;
            }
        }
        return msg;
    }
}
